package com.efrei.schoolmanager.model.obj;

import java.io.Serializable;

import com.efrei.schoolmanager.exceptions.LogicException;
import com.efrei.schoolmanager.tools.Verifs;

public class Medecin implements Serializable {
	private static final long serialVersionUID = -7583062154448964865L;

	/** Attributes */
	private int medecinId;
	private String nom;
	private String prenom;
	private String telephoneFixe;
	private String email;
	private String rue;
	private Ville ville;

	public Medecin() {
	}

	public Medecin(String nom, String prenom, String telephoneFixe,
			String email, String rue, Ville ville) {
		super();
		this.nom = nom;
		this.prenom = prenom;
		this.telephoneFixe = telephoneFixe;
		this.email = email;
		this.rue = rue;
		this.ville = ville;
	}

	@Override
	public String toString() {
		String sep = " ";
		return new StringBuilder().append(nom.toUpperCase()).append(sep)
				.append(prenom).toString();
	}

	public int getMedecinId() {
		return medecinId;
	}

	public void setMedecinId(int medecinId) {
		this.medecinId = medecinId;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getTelephoneFixe() {
		return telephoneFixe;
	}

	public void setTelephoneFixe(String telephoneFixe) {
		this.telephoneFixe = telephoneFixe;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getRue() {
		return rue;
	}

	public void setRue(String rue) {
		this.rue = rue;
	}

	public Ville getVille() {
		return ville;
	}

	public void setVille(Ville ville) {
		this.ville = ville;
	}

	public static void check(String nom, String prenom, String telephoneFixe,
			String email, String rue) throws LogicException {
		Verifs.checkString(nom.trim(), "nom medecin invalide");
		Verifs.checkString(prenom.trim(), "prenom medecin invalide");
		Verifs.checkNullString(telephoneFixe.trim(),
				"telephone fix medecin invalide");
		Verifs.checkNullString(email.trim(), "email medecin invalide");
		Verifs.checkString(rue.trim(), "rue medecin invalide");
	}
}
